package mytest.atomic.structure;

import java.util.concurrent.atomic.AtomicInteger;

public class CounterAI implements Counter {
	
	private AtomicInteger cnt;
	
	public CounterAI(){
		cnt=new AtomicInteger();
	}
	
	public CounterAI(int init){
		cnt=new AtomicInteger(init);
	}

	@Override
	public void inc() {
		cnt.incrementAndGet();

	}

	@Override
	public void dec() {
		cnt.decrementAndGet();

	}

	@Override
	public int getVal() {
		return cnt.get();
	}

}
